#pragma once

// Include Windows functions
#include <Windows.h>
#include <memory>
#include <glm.hpp>
#include <gtc\matrix_transform.hpp>

// OpenGL and GLEW Header Files and Libraries
#include <GL/glew.h>
//#include <GL/wglew.h>
// OpenGL and GLUT Header Files and Libraries
#include <GL/freeglut.h>
#include "Data.h"
#include "Program.h"
#include "Mesh.h"

// Error view Macro
#define GL_ERROR(str) { GLenum t1 = glGetError(); const GLubyte* error = gluErrorString( t1 ); str = std::string( (char *)error );}

class OpenGLRenderer
{
public:
	OpenGLRenderer(void); // Default constructor
	~OpenGLRenderer(void); // Destructor for cleaning up our application

	void init(Data* d);
	void display();
	void reshape(int w, int h);
	void keyboard(unsigned char key, int x, int y);

private:
	void initializeProgram();
	void initializeVertexBuffer(Data* v);

	int windowWidth; // Store the width of our window
	int windowHeight; // Store the height of our window
	
	std::auto_ptr<milo::Program>	_program;
	std::auto_ptr<milo::Shader>		_vertexShader;
	std::auto_ptr<milo::Shader>		_fragmentShader;
	milo::Mesh		_node;
	
	GLuint	_offsetUniform;
	GLuint	_perspectiveMatrixUnif;
};

